﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace GatoRatoQueijo
{
    class Carta : Objeto2D
    {
        static List<Carta> Cartas = new List<Carta>();
        static Random rnd = new Random(DateTime.Now.Millisecond);
        static float Depth;
        
        GameWindow window;

        private Carta(Texture2D textura, GameWindow window, float depth) : base(textura, null, depth)
        {
            this.window = window;
            ScaleX = 0.10f;
            ScaleY = 0.10f;
            x = y = 60;
            setarPontoDeReferencia(PontoDeReferencia.CENTRO);
        }


        public static void criarCarta(Texture2D textura, GameWindow window)
        {
            Carta carta = new Carta(textura, window, 0.1f);
            //Random rnd = new Random(DateTime.Now.Millisecond);
            carta.x = rnd.Next((int)((carta.textura.Width * carta.ScaleX) / 2), (int)(window.ClientBounds.Width - (carta.textura.Width * carta.ScaleX) / 2));
            carta.y = rnd.Next((int)((carta.textura.Height * carta.ScaleY) / 2), (int)(window.ClientBounds.Height - (carta.textura.Height * carta.ScaleY) / 2));
            Cartas.Add(carta);
        }

        public static void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            for (int i = 0; i < Cartas.Count; i++)
            {
                Cartas[i].draw(gameTime, spriteBatch);
            }
        }
    }
}
